import http from '@/utils/http'

import type {
  UserPatient,
  AddPatientForm,
  EditPatientForm
} from '@/types/user-patient'

export function getUserPatientListApi() {
  return http.get<UserPatient[]>('/patient/mylist')
}

export function getPatientDetailApi(id: string) {
  return http.get<Omit<UserPatient, 'age'>>(`/patient/info/${id}`)
}

export function addPatientApi(data: AddPatientForm) {
  return http.post<{ id: string }>('/patient/add', data)
}

export function editPatientApi(data: EditPatientForm) {
  return http.put<{ id: string }, EditPatientForm>('patient/update', data)
}

export function delPatientApi(id: string) {
  return http.delete<{ id: string }>('/patient/del', id)
}
